package com.gyl.service.Impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.gyl.domain.PageListRes;
import com.gyl.domain.QueryVo;
import com.gyl.mapper.SportMapper;
import com.gyl.service.SportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SportServiceImpl implements SportService {
    @Autowired
    private SportMapper sportMapper;
    @Override
    public PageListRes getAllSport(QueryVo vo) {
        List<Object> list = sportMapper.selectAll(vo);
        System.out.println("sportservice==============================================");
        for (Object o : list) {
            System.out.println(o);
        }
        Page<Object> page = PageHelper.startPage(vo.getPage(), vo.getRows());
        PageListRes pageListRes = new PageListRes();
        pageListRes.setTotal(page.getTotal());
        pageListRes.setRows(list);
        return pageListRes;
    }
}
